#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include "login.h"
#include <stdlib.h>

bool AddUser(P_User_t p)
{
    if (p == NULL)
        return false;
    P_User_t new_node = calloc(1, sizeof(User_t));
    if (new_node == NULL)
    {
        printf("%s,%d:calloc fail\n", __FUNCTION__, __LINE__);
        return false;
    }
    printf("请输入用户名：");
    scanf("%s", new_node->data.ID);
    printf("请输入用户密码：");
    scanf
    ("%s", new_node->data.passwd);

    P_User_t q = p;
    while (q->next != NULL)
    {
        q = q->next;
    }

    new_node->next = q->next;
    q->next = new_node;
    printf("用户添加成功！\n");
    return true;
}